
//获取映射名
function renderLeague(record, rowIndex, colIndex, options) {
	var leagueNa = "";
	var leagueid = gridObj.getRecordIndexValue(record, 'league');

	$.ajax({
		type : "post",
		url : "../para/getLeagueNa.do",
		data : {
			leagueid : leagueid
		},
		async : false,
		success : function(data) {
			leagueNa = data;
		}
	});
	return leagueNa;
}

function renderHome(record, rowIndex, colIndex, options) {
	var teamNa = "";
	var teamid = gridObj.getRecordIndexValue(record, 'home');
	var homerank = gridObj.getRecordIndexValue(record, 'homerank');

	$.ajax({
		type : "post",
		url : "../para/getTeamNa.do",
		data : {
			teamid : teamid
		},
		async : false,
		success : function(data) {
			teamNa = data;
		}
	});
	return "["+homerank+"]"+teamNa;
}

function renderGuest(record, rowIndex, colIndex, options) {
	var teamNa = "";
	var teamid = gridObj.getRecordIndexValue(record, 'guest');
	var guestrank = gridObj.getRecordIndexValue(record, 'guestrank');

	$.ajax({
		type : "post",
		url : "../para/getTeamNa.do",
		data : {
			teamid : teamid
		},
		async : false,
		success : function(data) {
			teamNa = data;
		}
	});
	return teamNa+"["+guestrank+"]";
}


function renderResult(record, rowIndex, colIndex, options) {
	
	var result = gridObj.getRecordIndexValue(record, 'result');
	var result_cn = "";
	if(result=="0"){
		var countLoss = $("#countLoss").val();
		var lossNum = parseInt(countLoss);
		lossNum++;
		$("#countLoss").val(lossNum);
		result_cn= "<span style='color:#00f'>负</span>";
	}else if(result=="1"){
		var countDraw = $("#countDraw").val();
		var drawNum = parseInt(countDraw);
		drawNum++;
		$("#countDraw").val(drawNum);
		result_cn ="<span style='color:#090'>平</span>";
	}else if(result=="3"){
		var countWin = $("#countWin").val();
		var winNum = parseInt(countWin);
		winNum++;
		$("#countWin").val(winNum);
		result_cn = "<span style='color:#f00'>胜</span>";
	}else{
		result_cn = "<span>暂无</span>";;
	}

	return result_cn;
}


function renderEwin(record, rowIndex, colIndex, options) {
	
	var fwin_str = gridObj.getRecordIndexValue(record, 'fwin');
	var ewin_str = gridObj.getRecordIndexValue(record, 'ewin');
	var fwin = parseFloat(fwin_str); 
	var ewin = parseFloat(ewin_str);
	if(ewin>fwin){
		return "<span style='background-color:#faa6a6'>"+ewin+"</span>";
	}else if(ewin<fwin){
		return "<span style='background-color:#c1ef8d'>"+ewin+"</span>";
	}else{
		return "<span >"+ewin+"</span>";
	}

}


function renderEdraw(record, rowIndex, colIndex, options) {
	
	var fdraw_str = gridObj.getRecordIndexValue(record, 'fdraw');
	var edraw_str = gridObj.getRecordIndexValue(record, 'edraw');
	var fdraw = parseFloat(fdraw_str); 
	var edraw = parseFloat(edraw_str);
	if(edraw>fdraw){
		return "<span style='background-color:#faa6a6'>"+edraw+"</span>";
	}else if(edraw<fdraw){
		return "<span style='background-color:#c1ef8d'>"+edraw+"</span>";
	}else{
		return "<span >"+edraw+"</span>";
	}
	
}


function renderEloss(record, rowIndex, colIndex, options) {
	
	var floss_str = gridObj.getRecordIndexValue(record, 'floss');
	var eloss_str = gridObj.getRecordIndexValue(record, 'eloss');
	var floss = parseFloat(floss_str); 
	var eloss = parseFloat(eloss_str);
	if(eloss>floss){
		return "<span style='background-color:#faa6a6'>"+eloss+"</span>";
	}else if(eloss<floss){
		return "<span style='background-color:#c1ef8d'>"+eloss+"</span>";
	}else{
		return "<span >"+eloss+"</span>";
	}
	
}



function renderEhandicap(record, rowIndex, colIndex, options) {
	
	var fhandicap = gridObj.getRecordIndexValue(record, 'fhandicap');
	var ehandicap = gridObj.getRecordIndexValue(record, 'ehandicap');

	if(fhandicap>ehandicap){
		return "<span style='background-color:#faa6a6'>"+ehandicap+"</span>";
	}else if(fhandicap<ehandicap){
		return "<span style='background-color:#c1ef8d'>"+ehandicap+"</span>";
	}else{
		return "<span >"+ehandicap+"</span>";
	}
	
}



function renderEhomewater(record, rowIndex, colIndex, options) {
	
	var fhomewater = gridObj.getRecordIndexValue(record, 'fhomewater');
	var ehomewater = gridObj.getRecordIndexValue(record, 'ehomewater');
	
	if(fhomewater>ehomewater){
		return "<span style='background-color:#c1ef8d'>"+ehomewater+"</span>";
	}else if(fhomewater<ehomewater){
		return "<span style='background-color:#faa6a6'>"+ehomewater+"</span>";
	}else{
		return "<span >"+ehomewater+"</span>";
	}
	
}


function renderEguestwater(record, rowIndex, colIndex, options) {
	
	var fguestwater = gridObj.getRecordIndexValue(record, 'fguestwater');
	var eguestwater = gridObj.getRecordIndexValue(record, 'eguestwater');
	
	if(fguestwater>eguestwater){
		return "<span style='background-color:#c1ef8d'; >"+eguestwater+"</span>";
	}else if(fguestwater<eguestwater){
		return "<span style='background-color:#faa6a6; '>"+eguestwater+"</span>";
	}else{
		return "<span >"+eguestwater+"</span>";
	}
	
}



